;; -*- coding: utf-8; lexical-binding: t; -*-

;; (with-eval-after-load 'python
;;   ;; run command `pip install jedi flake8 importmagic` in shell,
;;   ;; or just check https://github.com/jorgenschaefer/elpy
;;   (unless (or (is-buffer-file-temp)
;;               (not buffer-file-name)
;;               ;; embed python code in org file
;;               (string= (file-name-extension buffer-file-name) "org"))
;;     (setq elpy-shell-command-prefix-key "C-c C-f")
;;     (elpy-enable)
;;     (set-language-environment "UTF-8")
;;     (add-to-list 'process-coding-system-alist '("python3" . (utf-8 . utf-8)))
;;     (setq elpy-rpc-python-command "python3")
;;     ;; If you don't like any hint or error report from elpy,
;;     ;; set `elpy-disable-backend-error-display' to t.
;;     (setq elpy-disable-backend-error-display nil))
;;   ;; http://emacs.stackexchange.com/questions/3322/python-auto-indent-problem/3338#3338
;;   ;; emacs 24.4+
;;   (setq electric-indent-chars (delq ?: electric-indent-chars)))

;; (require 'use-package)

;; (use-package lsp-pyright
;;   :ensure t
;;   :hook (python-mode . (lambda ()
;;                           (require 'lsp-pyright)
;;                           (lsp))))  ; or lsp-deferred

(my/install-package-if-not-found 'lsp-python-ms)

(with-eval-after-load 'python
    (require 'lsp-python-ms)
    (setq lsp-python-ms-auto-install-server t)
    (add-hook 'python-mode-hook #'lsp)
    (add-hook 'python-mode-hook #'lsp-deferred)
  )

(provide 'init-python)
